<template>
  <div>
    <router-view/>

    <van-tabbar
      v-model="active"
      active-color="#07c160" @change="tabChange">

      <van-tabbar-item icon="home-o">主页</van-tabbar-item>
      <van-tabbar-item icon="search">测试页</van-tabbar-item>
      <van-tabbar-item icon="friends-o">标签</van-tabbar-item>
      <van-tabbar-item icon="setting-o">标签</van-tabbar-item>

    </van-tabbar>

  </div>
</template>

<script>
  export default {
    name: 'Index',
    data () {
      return {
        active: 0,
        routes:[
          '/',
          '/test'
        ]
      }
    },
    methods: {
      tabChange (index) {

        this.$router.replace(
          this.routes[index]
        )
      }
    }
  }
</script>

<style scoped>

</style>
